package com.shakev.coupon.data.mysql.controller;


import com.shakev.coupon.business.model.CategoryRes;
import com.shakev.coupon.business.service.CategoryBusiService;
import com.shakev.coupon.business.util.rest.RestResponse;
import com.shakev.coupon.data.mysql.entity.TCategory;
import com.shakev.coupon.data.mysql.service.ITCategoryService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author lws
 * @since 2019-06-05
 */
@RestController
public class TCategoryController {

    @Resource
    CategoryBusiService categoryBusiService;

    @GetMapping("/category/tree")
    public RestResponse tree(){
        List<CategoryRes> list = categoryBusiService.getCategoryTree();
        return RestResponse.success(list);
    }

}
